import React, { Component } from 'react'
import { Table, Tabs } from 'antd'
import { connect } from 'dva'
import BaseLayout from "@/components/Layout/BaseLayout";
import MasterInfo from '@/components/UserInfo/MasterInfo';
import ClassOS from './ClassOS'
import StudentOS from './StudentOS'
import TeacherOS from './TeacherOS'

const namespaceWebSocket = 'websocket'
const mapStateToProps = (state) => {
    const { token } = state['token']
    const { ws } = state[namespaceWebSocket]
    console.log(token)
    return { token, ws }
}
class Index extends Component {
    constructor(props) {
        super(props)
    }
    render() {
        const tabPaneMap = {};
        tabPaneMap.teacher = <Tabs.TabPane tab="教师管理" key="教师管理">
            <TeacherOS />
        </Tabs.TabPane>
        tabPaneMap.student = <Tabs.TabPane tab="学生管理" key="学生管理">
            <StudentOS />
        </Tabs.TabPane>
        tabPaneMap.class = <Tabs.TabPane tab="班级管理" key="班级管理">
            <ClassOS />
        </Tabs.TabPane>
        tabPaneMap.master = <Tabs.TabPane tab="管理员信息" key="管理员信息">
            <MasterInfo />
        </Tabs.TabPane>
        const tabsPane = []
        tabsPane.push(tabPaneMap.teacher)
        tabsPane.push(tabPaneMap.student)
        tabsPane.push(tabPaneMap.class)
        tabsPane.push(tabPaneMap.master)
        return <BaseLayout title="在线考试·管理员" tabsPane={tabsPane} activeKey="教师管理" />;
    }
}

export default connect(mapStateToProps)(Index)